﻿using System;

namespace 策略模式
{
    public interface IMoveType
    {
        void Move();
    }
    public interface IAttackType
    {
        void Attack();
    }
    public interface IJiaxueType
    {
        void Jiaxue();
    }
    public abstract class Hero
    {
        public string HeroName { get; set; }
        public IMoveType MoveAction { get; set; }
        public IAttackType AttackAction { get; set; }
        public IJiaxueType JiaxueAction { get; set; }
        public void DisplayName()
        {
            if (HeroName == null)
                return;
            Console.WriteLine(HeroName);
        }
        public void OnMove()
        {
            MoveAction?.Move();

        }
        public void OnAttack()
        {
            AttackAction?.Attack();

        }
        public void OnJiaxue()
        {
            JiaxueAction?.Jiaxue();

        }

    }

}
